package ku.report.dao;

import java.sql.SQLException;
import java.util.List;

import ku.report.dto.EmployeesDTO;
import ku.report.ibatis.SqlDaoSuport;
import ku.report.idao.IEmployeesDAO;
public class EmployeesDAO extends SqlDaoSuport implements IEmployeesDAO{

	public EmployeesDAO() {
		super();
	}

	public EmployeesDAO(String path) {
		super(path);
	}

	@Override
	public EmployeesDTO empLogin(EmployeesDTO edto) {
		EmployeesDTO dto = new EmployeesDTO();
		try {
			dto = (EmployeesDTO)this.getSqlMapper().queryForObject("empLogin", edto);
		} catch (SQLException e) {
			System.out.println("empLogin = "+e);
		}
		return dto;
	}

	@Override
	public List<EmployeesDTO> empList() {
		List<EmployeesDTO> emplist = null;
		
		try {
			emplist = (List<EmployeesDTO>)this.getSqlMapper().queryForList("empList");
		} catch (SQLException e) {
			System.out.println("empList = "+e);
		}
		return emplist;
	}

	@Override
	public EmployeesDTO getMyInfo(int empno) {
		EmployeesDTO edto = new EmployeesDTO();
		try {
			edto = (EmployeesDTO)this.getSqlMapper().queryForObject("getMyInfo", empno);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public int changePassword(EmployeesDTO dto) {
		int check = 0;
		try {
			check = this.getSqlMapper().update("changePassword", dto);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return check;
	}

}
